package com.dqx.haoqiu.repository.repository.news;
import com.dqx.haoqiu.repository.entity.NewsEntity;
import com.dqx.haoqiu.repository.repository.news.local.NewsLocalSource;
import com.dqx.haoqiu.repository.repository.news.remote.NewsRemoteSource;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * 用户数据仓库
 */
public class NewsRepository implements NewsSource {
    //本地数据源
    private final NewsLocalSource localSource;
    //远程数据源
    private final NewsRemoteSource remoteSource;

    @Inject
    public NewsRepository(NewsLocalSource localSource, NewsRemoteSource remoteSource) {
        this.localSource = localSource;
        this.remoteSource = remoteSource;
    }

    @Override
    public Observable<List<NewsEntity>> getNews(int channel, int page, int page_size, long currentTime, int category) {
        return remoteSource.getNews(channel, page, page_size, currentTime, category);
    }
}
